|
|
|
|
|
|
|
This code just declares Public properties for the class. You need to add the Class_Initialize routine, too. Enter the code from Listing 21.9. |
|
|
|
|
|
|
|
|
Listing 21.9. Coding the Class_Initialize event. |
|
|
|
|
|
|
|
|
Private Sub Class_Initialize()
'
' initial settings
'
strDBName = App.Path & "\security.mdb"
intMaxTries = 3
strTitle = "User Maintenance Library"
strUserIDProp = ""
blnRightsLoaded = False
'
End Sub |
|
|
|
|
|
|
|
|
This routine passes the local version of the database name property to the form and then calls the form. Note the use of the Err.Raise method in the error handler. This simply passes the error back to the calling program with some additional information that you can use to diagnose the problem. |
|
|
|
|
|
|
|
|
Finally, to test this library you need to start a second project (Visual Basic 5 Standard EXE) in the same group (select File | New Project from the main menu). This second project is used to instantiate a new recObject and call it from within your program. This is all handled through a single BAS module, not a form. All you need to do is remove the default form from your EXE project, and add the module to your form. Add the code from Listing 21.10 to your new module file. |
|
|
|
|
|
|
|
|
Listing 21.10. Building a second project to test the usrObject library. |
|
|
|
|
|
|
|
|
Option Explicit
'
' project-level vars
'
Public objUser As Object
Public Sub Main()
'
' main entry for form-less project
'
Set objUser = New usrObject
objUser.DBName = App.Path & "\..\..\data\security\security.mdb"
'
objUser.UsersForm
'
End
'
End Sub |
|
|
|
|
|